<extend name="Common/base" />
<block name="content">
<style>
	.clear{ clear:both; }
	.account-center{ width:100%; }
	.account-c-p{ width: 220px; display:inline-block; float:left; font-size:17px;  color:#333; text-align:left; }
	.account-c-p-m{ font-size:24px; padding-top:5px;font-weight:bold;}
	.account-c-p-m span{ font-size:40px; }
	.account-c-b{ width:500px; float:left; margin-left:80px; text-align:left;}
	.account-c-b a.ac-but{ font-size:16px; background:#e4393c; padding:8px 50px; border-radius:5px; margin-top:36px; display:inline-block; color:#fff; float:left; margin-right:30px;}
	.account-c-ye{ font-size:14px; color:#999; float:left; margin-top:15px; text-align:left; width:100%;}
	.account-c-log_list{ width:100%; margin-top:30px; float:left}
	.account-c-log_list table{ width:100%; line-height:200%; font-size:14px;}
	.account-c-log_list table td.text-c-left{ text-align:left;}
	.account-c-log_list table thead td{ background:#fbfbfc; height:50px;}
	.account-c-log_list table tbody td{ border-bottom:1px solid #efefef; height:80px;}
	.account-c-b a{ display:inline-block; margin-top:56px;}
</style>
<div class="col-md-10">
	<div class="row">
		<div class="panel panel-default">
			<div class="panel-heading">
				<div class="text-muted bootstrap-admin-box-title">账户中心</div>
			</div>
			<div class="bootstrap-admin-panel-content text-muted" style="padding: 60px 50px; text-align: center">
				<div class="account-center">
					<div class="account-c-p">
						我的可用余额
						<div class="account-c-p-m"><span>{:str_replace("." , '.</span>' , $member_info['money'])}</div>
					</div>
					<div class="account-c-b">
						<a href="" class="ac-but">充值</a>
						<a href="" class="ac-but" data-toggle="modal" data-target="#myModal">提现</a>
						<a href="">提现列表</a>
					</div>
					<div class="account-c-ye">全部余额：<?php echo number_format($member_info['money'] + $member_info['freeze_money'] , 2); ?>，冻结余额：{$member_info.freeze_money}</div>
					<div class="account-c-log_list">
						<table>
							<thead>
								<tr>
									<td width="200">时间</td>
									<td width="180">金额</td>
									<td width="180">操作</td>
									<td>备注</td>
								</tr>
							</thead>
							<tbody>
							<volist name="account_data" id="vo">
								<tr>
									<td width="200">{$vo.create_time}</td>
									<td width="180">{$vo.price}</td>
									<td width="180"><eq name="vo.type" value="1">收入<else/>支出</eq></td>
									<td>{$vo.note}</td>
								</tr>
							</volist>
							</tbody>
						</table>
						<neq name="page_num" value="0">
						<div class="pagination-container">
							<ul class="pagination">
								<li><a href="{:U("account" , array("page" => ($page <= 0 ? 1 : $page)))}">&laquo;</a></li>
								<?php for( $i = 1; $i <= $page_num; $i++ ) : ?>
								<li <?php if($i == $page){ ?>class="active"<?php } ?>>
									<a href="{:U("account" , array("page" => $i))}">{$i}</a>
								</li>
								<?php endfor; ?>
								<li><a href="{:U("account" , array("page" => ($page > $page_num ? $page_num : $page)))}">&raquo;</a></li>
							</ul>
						</div>
						</neq>
					</div>
					<div class="clear"></div>
				</div>
			</div>
		</div>
	</div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">账户提现</h4>
      </div>
      <div class="modal-body form-horizontal">
		<div class="form-group">
			<label class="col-lg-3 control-label">可提现金额</label>
			<div class="col-lg-4">
				<span class="form-control" style="border:none;box-shadow:none;">{$member_info['money']}</span>
			</div>
		</div>
		<div class="form-group">
			<label class="col-lg-3 control-label">提现金额</label>
			<div class="col-lg-4">
				<input class="form-control" id="tx_price" datatype="*" nullmsg="联系人不能为空" type="text"> 
			</div>
			<input class="btn btn-default" type="button" id="alltix" value="全部提现">
		</div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        <button type="button" class="btn btn-primary" id="ok_tx_sub">确认提现</button>
      </div>
    </div>
  </div>
</div>
</block>
<block name="script">
	<script>
		var money = {$member_info['money']};
		$(document).on( 'click' , '#alltix' , function(){
			$("#tx_price").val(money);
		});
		$(document).on("click" , '#ok_tx_sub' , function(){
			if( money < parseFloat($("#tx_price").val()) ){
				$.message({message:'提现金额不能大于' + parseInt( money ) + '元',type:'error'});
				return false;
			}
			$.post('{:U('index/forward')}' , { money : $("#tx_price").val() } , function(data){
				if( data.status == 1 ) {
					$.message(data.info);
					setTimeout(function(){
						location.reload();
					},1500);
				} else {
					$.message({message:data.info,type:'error'});
				}
			},'json');
		});
	</script>
</block>